import testConfig from './test.js'
import prodConfig from './prod.js'
import devConfig from './dev.js'
import browserEnv from './browserEnv.js'

console.log('config.js 执行')

let config = null
let base = {
  siteName: '知乎日报',     //  网站名称
  window_namespace_name: 'zhihu',
  localforage_name: 'zhihu',
  app_version: process.env.REACT_APP_VERSION || '1.0.0',       //  set "REACT_APP_VERSION=1.1.0" && npm start
  img_load_default_image: require('../assets/images/default/default.png'),
  browser_env: browserEnv,

  api_baseurl: '',
  env: '',

  init: () => {
    window[config.window_namespace_name] = {}
  },
}

if (process.env.NODE_ENV === 'development') {
  config = {
    ...base,
    ...devConfig
  }
} else if (window.location.origin.indexOf('cihaotang') > -1) {    //  todo 测试环境
  config = {
    ...base,
    ...testConfig
  }
} else {
  config = {
    ...base,
    ...prodConfig
  }
}


export default config
